<template>
    <el-card>
        <Components title="今日销售额" :value="numberFormat(salesToday)">
            <div class="compare-wrap">
                <div class="compare">
                    <span>日同比　</span>
                    <span> {{ salesGrowthLastDay }}%</span>
                    <span class="decrement"></span>
                </div>
                <div class="compare">
                    <span>月同比　</span>
                    <span> {{ salesGrowthLastMonth }}%</span>
                    <span class="increment"></span>
                </div>
            </div>
            <template #footer>
                <span>昨日销售额 </span>
                <span class="emphasis">{{ moneyFormat(salesLastDay) }}</span>
            </template>
        </Components>
    </el-card>
</template>

<script lang="ts">
import Components from './Components.vue'
export default {
    name: 'TodaySales',
    components: {
        Components
    }
}
</script>
<script lang="ts" setup>
import { computed } from 'vue'
import { useReportDataStore } from '@/stores/reportData'
import useFormat from '@/hooks/userForm'
const reportDataStore = useReportDataStore()
const { numberFormat, moneyFormat } = useFormat()

// 今日销售额
const salesToday = computed(() => reportDataStore.reportData.salesToday)
// 昨日销售额
const salesLastDay = computed(() => reportDataStore.reportData.salesLastDay)
// 日同比
const salesGrowthLastDay = computed(() => reportDataStore.reportData.salesGrowthLastDay)
// 月同比
const salesGrowthLastMonth = computed(() => reportDataStore.reportData.salesGrowthLastMonth)



</script>


<style lang="scss" scoped>
.compare-wrap {
    height: 100%;
    display: flex;
    flex-direction: column;
    font-size: 12px;
    font-weight: 600;
    color: #666;

    .compare {
        flex: 1;
        display: flex;
        align-items: center;
    }
}
</style>